package com.qtzw.controller;

import com.qtzw.domain.User;
import com.qtzw.mapper.UserMapper;
import com.qtzw.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/user")
public class MybatisController {

    @Autowired
    private UserService userService;

    @RequestMapping("/query")
    public ModelAndView queryUserList(){
        ModelAndView modelAndView = new ModelAndView("index");
        User user = userService.queryFirstUser();
        modelAndView.addObject("user", user);
        modelAndView.setViewName("index");
        return modelAndView;
    }

}
